/**
 * Reference to: http://j2ee.masslight.com/Chapter3.html
 * 
 * Example 1: Play a tag
 * 
 */

package com.wang.taglib;

import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;

public class HelloTaglib extends TagSupport
{
	private static final long serialVersionUID = 7416897016834515176L;
	
	public String getGreeting()
	{
		return "Hello World!";
	}

	public int doStartTag() throws JspException
    {
		try
		{
			JspWriter out = pageContext.getOut();
			out.write(getGreeting());
		}
		catch(Exception e)
		{   
			throw new JspException(e.getMessage());
		}

		/*
		 * SKIP_BODY: Tell the JSP to not output the content contained in the body of the tag
		 * EVAL_BODY_INCLUDE: If the content in the body of the tag should be outputted
		 * EVAL_PAGE: Signifies that the JSP should evaluate the rest of the contents of the page
		 */
		return EVAL_PAGE;
    }
}
